<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>订单添加</title>
    <link rel="stylesheet" href="./layui/css/layui.css">
</head>
<body>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>订单添加</legend>
</fieldset>
<!--面板-->
<div class="layui-card">
    <div class="layui-card-header"></div>
    <div class="layui-card-body">
        <!--    表单-->
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">发货人</label>
                <div class="layui-input-block">
                    <input type="text" name="shipper" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">发货人电话</label>
                <div class="layui-input-block">
                    <input type="text" name="shipperPhone" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">发货人地址</label>
                <div class="layui-input-block">
                    <input type="text" name="shipperAddress" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">收货人</label>
                <div class="layui-input-block">
                    <input type="text" name="receiver" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">收货人电话</label>
                <div class="layui-input-block">
                    <input type="text" name="receiverPhone" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">收货人地址</label>
                <div class="layui-input-block">
                    <input type="text" name="receiverAddress" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>

<script src="./layui/layui.js"></script>
<script src="./js/jquery-3.6.4.min.js"></script>
<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:"/order/add",
                type:"POST",
                data:data.field,
                dataType:"text",
                success:function (result,textStatus) {
                    layui.layer.msg(result);
                },
                error:function(result,textStatus){
                    layui.layer.msg(textStatus);
                }
            })
            return false;
        });
    });
</script>
</body>
</html>